from appium.webdriver.common.mobileby import MobileBy
from app_study.app_snowball.base.snowball_app import SnowballApp


class SearchResultPage(SnowballApp):

    def goto_stock_tab(self):
        # click 股票
        self.find_and_click(MobileBy.XPATH, "//*[@text='股票']")
        return self

    def get_price(self):
        # 找到阿里巴巴所对应的股票价格
        current_price = self.find_and_gettext(MobileBy.XPATH,"//*[@text='BABA']/../../..//*[@resource-id='com.xueqiu.android:id/current_price']")
        return float(current_price)